package com.cdream.basic.util;

import cn.hutool.core.map.MapUtil;
import com.cdream.basic.util.model.WordParam;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;

/**
 * @author cdream
 * @date 2021/1/3
 */
@Slf4j
public class PoiUtilExample {
    public static void main(String[] args) throws IOException, InvocationTargetException, IllegalAccessException {
        WordParam wordParam = new WordParam();
        wordParam.setTestNum("20200821");
        wordParam.setTestDescription("描述测试");
        wordParam.setTestPlan("解决方案");
        wordParam.setTestOrg("测试机构");
        wordParam.setTestTime("2020年8月21日");

        // 存放匹配字段的值
        Map<String,Object> map = MapUtil.<String,Object>builder()
                .put("${编号}", "TestNum")
                .put("${方案}", "TestPlan")
                .put("${时间}", "TestTime")
                .build();

        WordUtil.generateWord(map,"C:\\Users\\cdream\\Documents\\招标函.docx","C:\\Users\\cdream\\Documents\\招标函1.docx");

    }
}
